GtkSearchBar: Handle lack of an entry
authorMatthias Clasen <mclasen@redhat.com>
Mon, 9 Jun 2014 13:36:47 +0000 (09:36 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 9 Jun 2014 17:31:09 +0000 (13:31 -0400)
We were not dealing with the possibility of priv->entry being
NULL in all places.

gtk/gtksearchbar.c

index 8104abef12a3a91829fcd8ab54cd52e742e9f8a3..1181d48ce751c2264293aab996ff98dd45ba5e66 100644 (file)
@@ -254,10 +254,13 @@ reveal_child_changed_cb (GObject      *object,
 
   priv->reveal_child = reveal_child;
 
-  if (reveal_child)
-    _gtk_entry_grab_focus (GTK_ENTRY (priv->entry), FALSE);
-  else
-    gtk_entry_set_text (GTK_ENTRY (priv->entry), "");
+  if (priv->entry)
+    {
+      if (reveal_child)
+        _gtk_entry_grab_focus (GTK_ENTRY (priv->entry), FALSE);
+      else
+        gtk_entry_set_text (GTK_ENTRY (priv->entry), "");
+    }
 
   g_object_notify (G_OBJECT (bar), "search-mode-enabled");
 }